home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
3DMAZE
/
INITMAZE.C
< prev
next >
Wrap
Text File
|
1991-02-16
|
2KB
|
91 lines
/******************************************************
*
* InitMaze.c v. 1.0
* 1991 By Mark Frohnmayer
*
* NOTE - This header must appear at the beginning of all 3-D maze files!
*
* If you have any comments or recommended modifications for this code,
* email me on America On-Line at "Mark Frohn" or snail mail me at:
*
* Mark Frohnmayer
* 2875 Baker Blvd
* Eugene, OR 97403
*
* If you use this code in any program, commercial or otherwise, give
* me credit in the about box.
*
* THIS CODE MAY NOT BE SOLD OR DISTRIBUTED AT COST OR AS PART OF SOLD
* PACKAGE WITHOUT PRIOR WRITTEN CONSENT OF THE AUTHOR.
*
******************************************************/
#include "MazeData.h"
int grdBytes;
Ptr MazeImgAdd[7];
Rect MazeRect;
BitMap MazeImage[7];
viewpoint u;
view uview;
Rect viewRects[15];
char maze[16][16] = {
{ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 },
{ 1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1 },
{ 1,0,1,0,1,1,0,0,0,0,0,1,0,1,0,1 },
{ 1,0,1,0,1,0,1,0,0,0,0,0,1,1,0,1 },
{ 1,0,1,0,1,0,0,1,0,0,0,0,0,1,0,1 },
{ 1,0,1,0,1,1,0,1,1,0,0,0,0,0,0,1 },
{ 1,0,1,0,0,0,0,1,1,1,0,0,0,0,0,1 },
{ 1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1 },
{ 1,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1 },
{ 1,1,0,1,1,1,0,1,1,0,1,1,0,0,0,1 },
{ 1,1,0,0,0,1,0,1,1,0,0,0,1,1,0,1 },
{ 1,1,1,0,0,1,0,1,1,0,1,0,0,0,0,1 },
{ 1,0,1,0,1,0,0,0,1,0,1,0,1,0,0,1 },
{ 1,0,1,0,1,0,0,0,1,0,1,0,1,0,0,1 },
{ 1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,1 },
{ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 },
};
int rectVals[30] =
{ 0,20,20,79,79,139,139,198,198,216, 0,60,60,158,158,216, 0,33,33,184,
184,216, 33,59,59,79,139,159,159,184 };
DoRects()
{
int i;
for( i = 0; i < 15; i++) {
SetRect(&(viewRects[i]), rectVals[i*2], 0, rectVals[i*2 + 1], 185);
}
}
InitMaze()
{
int i;
PicHandle thePic;
grdBytes = 28;
DoRects();
SetRect(&MazeRect, 0, 0, 216, 185);
thePic = GetPicture(134);
DrawPicture(thePic, &MazeRect);
do{} while(!Button());
for(i=0;i<7;i++) {
if(i != 6) thePic = GetPicture(128+i);
MazeImgAdd[i] = NewPtr((long) (28 * 185));
if(!MazeImgAdd[i]) ExitToShell();
MazeImage[i].baseAddr = (QDPtr) MazeImgAdd[i];
MazeImage[i].rowBytes = grdBytes;
SetRect(&MazeImage[i].bounds, 0, 0, 224, 185);
if(i != 6) {
EraseRect(&MazeRect);
DrawPicture(thePic, &MazeRect);
CopyBits(&thePort->portBits, &MazeImage[i], &MazeRect,
&MazeRect, srcCopy, 0L);
}
}
u.x = 1;
u.y = 14;
u.facing = 0;
SetView();
}